<jsp:directive.page contentType="text/html;charset=UTF-8" />

<div class="tabbable">
	<ul class="nav nav-tabs">
		<li class="active"><a href="javascript:#taskItmeList"
			data-toggle="tab">异常任务项</a></li>
		<li><a href="javascript:#longTime"
			data-toggle="tab">任务项状态查询</a></li>
	</ul>
	<div class="tab-content">
		<div class="tab-pane active" id="taskItmeList">
			<div class="panel-group" role="tablist" style="margin-bottom: 0px;">
				<div class="panel panel-default">
					<div class="panel-heading" role="tab" id="collapseListGroupHeading1" style="padding-top: 5px;padding-bottom: 5px;">
						<table style="width: 100%; height: 100%">
							<tr>
								<td width="30%" align="left"><button type="button" class="btn btn-primary btn-sm" data-ng-click="recoverySelected()">恢复已选项</button></td>
								<td align="center">
									<h4 class="panel-title" style="color: red;">（生产环境请不要随意恢复任务项，请先确认执行任务处于异常状态的应用已经重启或者任务已经执行结束；发版时造成的异常任务，会在业务系统重启5分钟后自动恢复。）</h4>
								</td>
								<td width="30%" align="right">
										<button type="button" class="btn btn-primary btn-sm" data-ng-click="query()">查询</button>
								<a
									class="collapsed btn btn-success btn-sm" title="显示/隐藏查询条件"
									role="button" data-toggle="collapse"
									href="javascript:#collapseListGroup1" aria-expanded="true"
									aria-controls="collapseListGroup1"> 
										<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
								</a></td>
							</tr>
						</table>
					</div>
					<div id="collapseListGroup1" class="panel-collapse collapse in"
						role="tabpanel" aria-labelledby="collapseListGroupHeading1"
						aria-expanded="true" style="height: 40px;">
						<ul class="list-group">
							<li class="list-group-item"
								style="padding-top: 5px; padding-bottom: 5px;">
								<div class="row">
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">作业ID</span> 
											<input type="text" class="form-control"  data-ng-model="taskItemQuery.queryJobId">
										</div>
									</div>
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">任务ID</span> 
											<input type="text" class="form-control"  data-ng-model="taskItemQuery.queryTaskId">
										</div>
									</div>
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">任务运行 Ip/uuid</span> 
											<input type="text" class="form-control"  data-ng-model="taskItemQuery.taskTrackerIp">
										</div>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<table class="table table-hover table-striped table-bordered"
				border="1" style="width: 100%">
				<thead>
					<tr>
						<td width="50px;" align="center">No.</td>
						<td width="50px;" align="center"><input type="checkbox" data-ng-model="ckAllSelected" data-ng-click="selectedAll()"></td>
						<td width="350px;">任务项</td>
						<td width="100px;">状态</td>
						<td width="150px;">最后一次分配时间</td>
						<td width="150px;">状态同步时间</td>
						<td width="150px;">下一次执行时间</td>
						<td>任务运行 UUID</td>
						<td width="50px;">操作</td>
					</tr>
				</thead>
				<tbody>
					<tr data-ng-repeat="item in taskItems">
						<td align="center" data-ng-bind="$index + 1"></td>
						<td align="center"><input type="checkbox" data-ng-model="item.selected"></td>
						<td data-ng-bind="item.taskItemId"></td>
						<td data-ng-bind="item.taskItemStatus"></td>
						<td data-ng-bind="item.lastFetchTime | dateFilter"></td>
						<td data-ng-bind="item.lastStatusUpdateTime | dateFilter"></td>
						<td data-ng-bind="item.nextRunTime | date :'yyyy-MM-dd HH:mm:ss'"></td>
						<td data-ng-bind="(item.lastFetchTaskTrackerUuid!=null && item.lastFetchTaskTrackerUuid!='')?item.lastFetchTaskTrackerUuid:item.taskRunner.taskRunnerUuid"></td>
						<td><button type="button" class="btn btn-primary btn-xs"
								data-ng-click="recovery(item.taskItemId)">恢复</button></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="tab-pane" id="longTime">
			<div class="panel-group" role="tablist" style="margin-bottom: 0px;">
				<div class="panel panel-default">
					<div class="panel-heading" role="tab" id="collapseListGroupHeading2" style="padding-top: 5px;padding-bottom: 5px;">
						<table style="width: 100%; height: 100%">
							<tr>
								<td width="30%" align="left"></td>
								<td align="center">
									<h4 class="panel-title">Data List</h4>
								</td>
								<td width="30%" align="right">
										<button type="button" class="btn btn-primary btn-sm" data-ng-click="query4Status()">查询</button>
								<a
									class="collapsed btn btn-success btn-sm" title="显示/隐藏查询条件"
									role="button" data-toggle="collapse"
									href="javascript:#collapseListGroup2" aria-expanded="true"
									aria-controls="collapseListGroup2"> 
										<span class="glyphicon glyphicon-filter" aria-hidden="true"></span>
								</a></td>
							</tr>
						</table>
					</div>
					<div id="collapseListGroup2" class="panel-collapse collapse in"
						role="tabpanel" aria-labelledby="collapseListGroupHeading2"
						aria-expanded="true" style="height: 80px;">
						<ul class="list-group">
							<li class="list-group-item"
								style="padding-top: 5px; padding-bottom: 5px;">
								<div class="row">
									<div class="col-lg-6">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">状态</span> 
											<span class="form-control">
												<label class="checkbox-inline" data-ng-repeat="item in taskItemStatus">
												  <input type="checkbox" id="inlineCheckbox1" value="{{item.value}}" data-ng-model="item.selected"> {{item.value}}
												</label>
											</span> 
										</div>
									</div>
									<div class="col-lg-6">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">运行时长</span> 
											<input type="number" class="form-control" min="1" max="1440" data-ng-model="longTime">
											<span class="input-group-addon">单位：分钟，查询正在运行的超过此时长的任务项</span> 
										</div>
									</div>
								</div>
							</li>
							<li class="list-group-item"
								style="padding-top: 5px; padding-bottom: 5px;">
								<div class="row">
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">作业ID</span> 
											<input type="text" class="form-control"  data-ng-model="taskItem4StatusQuery.queryJobId">
										</div>
									</div>
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">任务ID</span> 
											<input type="text" class="form-control"  data-ng-model="taskItem4StatusQuery.queryTaskId">
										</div>
									</div>
									<div class="col-lg-4">
										<div class="input-group input-group-sm">
											<span class="input-group-addon">任务运行 Ip/uuid</span> 
											<input type="text" class="form-control"  data-ng-model="taskItem4StatusQuery.taskTrackerIp">
										</div>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<table class="table table-hover table-striped table-bordered"
				border="1" style="width: 100%">
				<thead>
					<tr>
						<td width="50px;" align="center">No.</td>
						<td width="350px;">任务项</td>
						<td width="100px;">状态</td>
						<td width="150px;">最后一次分配时间</td>
						<td width="150px;">状态同步时间</td>
						<td width="150px;">下一次执行时间</td>
						<td>任务运行 UUID</td>
					</tr>
				</thead>
				<tbody>
					<tr data-ng-repeat="item in taskItems4Status">
						<td align="center" data-ng-bind="$index + 1"></td>
						<td data-ng-bind="item.taskItemId"></td>
						<td data-ng-bind="item.taskItemStatus"></td>
						<td data-ng-bind="item.lastFetchTime | dateFilter"></td>
						<td data-ng-bind="item.lastStatusUpdateTime | dateFilter"></td>
						<td data-ng-bind="item.nextRunTime | date :'yyyy-MM-dd HH:mm:ss'"></td>
						<td data-ng-bind="(item.lastFetchTaskTrackerUuid!=null && item.lastFetchTaskTrackerUuid!='')?item.lastFetchTaskTrackerUuid:item.taskRunner.taskRunnerUuid"></td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</div>
